package com.aletto.general_store.presenters.core;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;

import com.aletto.general_store.data.model.GoodsDetails;
import com.sisyphus.spinach.core.INetTask;
import com.sisyphus.spinach.ui.configs.impl.ITemplate;

public abstract class SimpleTemplate<T> implements ITemplate<T> {

    @Override
    public void execute(@NonNull Lifecycle lifecycle) {
        INetTask.Presenter<T, INetTask.View<T>> presenter = presenter();
        presenter.bind(view());
        lifecycle.addObserver(presenter);
        presenter.execute();
    }

    public void execute() {
        INetTask.Presenter<T, INetTask.View<T>> presenter = presenter();
        presenter.bind(view());
        presenter.execute();
    }

}
